/**
 * @param {string} s
 * @return {string}
 */
var removeDuplicates = function (s) {
    const stack = [];
    for (let i = 0; i < s.length; i++) {
        switch (s[i]) {
            case (stack[stack.length - 1]):
                stack.pop();
                console.log('=' + stack)
                break;
            default:
                stack.push(s[i]);
                break;
        }
    }
    return stack.join('');
};
console.log(':' + removeDuplicates('acbbcacac'))